package org.massdgames.thunder.server.domain.strategy;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.massdgames.thunder.server.domain.Card;
import org.massdgames.thunder.server.domain.CardType;
import org.massdgames.thunder.server.domain.Deck;

public class BasicVillageLoadStrategy implements VillageLoadStrategy {

    public Deck load(Deck deck) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream("deck.properties"));

        int villageCardCount = new Integer(
                properties.getProperty("village.count"));

        for (int i = 0; i < villageCardCount; i++) {
            Card villageCard = new Card();
            villageCard.setCardId(i);
            villageCard.setName(properties
                    .getProperty("village." + i + ".name"));
            villageCard.setCardType(CardType.VILLAGE);
            deck.addCard(villageCard);
        }
        return deck;
    }

}
